package com.douqu.game.core.config.hegemony;

import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.factory.DataFactory;
import com.douqu.game.core.util.LogUtils;

import java.util.List;

/**
 * @author: miracle.
 * Description： 连杀分配置
 * Date: 2018/6/25 0025 下午 5:08
 * Huan Yu Copyright (c) 2017 All Rights Reserved.
 */
public class HegemonySkillCountConfig extends GameObject{

    /**
     * 连杀数量
     */
    public int count;

    /**
     * 分数
     */
    public int score;

    /**
     * 杀npc得分
     */
    public int npcScore;

    @Override
    public boolean check() {
        if (count <= 0){
            LogUtils.error("HegemonySkillCountConfig check count <= 0 ,-> id:" + id + " count:" + count);
            return false;
        }
        if (score < 0){
            LogUtils.error("HegemonySkillCountCOnfig check score < 0 ,-> id:" + id + " score:" + score);
            return false;
        }
        if (npcScore < 0){
            LogUtils.error("HegemonySkillCountConfig check npcScore < 0,-> id:" + id + " npcScore:" + npcScore);
            return false;
        }
        return true;
    }

    /**
     * 获取当前连杀的
     * @param c
     * @return
     */
    public static HegemonySkillCountConfig getByCount(int c){
        List<HegemonySkillCountConfig> list = DataFactory.getInstance().getDataList(DataFactory.HEGEMONY_SKILL_COUNT);
        for (HegemonySkillCountConfig config:list){
            if (config.count == c){
                return config;
            }
        }
        return list.get(list.size() - 1);
    }
}
